package com.esri.core.internal.tasks.ags;

import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.map.ImageServiceParameters;
import com.esri.core.map.MosaicRule;
import com.esri.core.map.TimeExtent;
import java.util.HashMap;

/* loaded from: classes.dex */
public class l extends n {
    private static final String g = "mosaicRule";
    private static final long serialVersionUID = 1;
    int a = -1;
    int b = -1;
    SpatialReference c;
    Envelope d;
    SpatialReference e;
    ImageServiceParameters f;
    private TimeExtent h;
    private com.esri.core.internal.value.a i;
    private String j;

    @Override // com.esri.core.internal.tasks.f
    public boolean validate() {
        return true;
    }

    public int a() {
        return this.a;
    }

    public void a(int i) {
        this.a = i;
    }

    public int b() {
        return this.b;
    }

    public void b(int i) {
        this.b = i;
    }

    public SpatialReference c() {
        return this.c;
    }

    public void a(SpatialReference spatialReference) {
        this.c = spatialReference;
    }

    public Envelope d() {
        return this.d;
    }

    public void a(Envelope envelope) {
        this.d = envelope;
    }

    public SpatialReference e() {
        return this.e;
    }

    public void b(SpatialReference spatialReference) {
        this.e = spatialReference;
    }

    public ImageServiceParameters f() {
        return this.f;
    }

    public void a(ImageServiceParameters imageServiceParameters) {
        this.f = imageServiceParameters;
    }

    public void a(com.esri.core.internal.value.a aVar) {
        this.i = aVar;
    }

    public void a(String str) {
        this.j = str;
    }

    @Override // com.esri.core.internal.tasks.f
    /* renamed from: g */
    public HashMap<String, String> generateRequestParams() throws Exception {
        int[] bandIds;
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("f", "image");
        if (this.d != null) {
            hashMap.put("bbox", this.d.getXMin() + "," + this.d.getYMin() + "," + this.d.getXMax() + "," + this.d.getYMax());
            if (this.e != null) {
                if (o() && q()) {
                    hashMap.put("bboxSR", c(this.e));
                } else {
                    SpatialReference spatialReference = this.e;
                    if (spatialReference != null) {
                        hashMap.put("bboxSR", Integer.toString(spatialReference.getID()));
                    }
                }
            }
        }
        if (this.a > 0 && this.b > 0) {
            hashMap.put("size", this.a + "," + this.b);
        }
        if (this.c != null) {
            if (o() && q()) {
                hashMap.put("imageSR", c(this.c));
            } else {
                hashMap.put("imageSR", Integer.toString(this.c.getID()));
            }
        }
        ImageServiceParameters imageServiceParameters = this.f;
        if (imageServiceParameters != null) {
            if (imageServiceParameters.getFormat() != null) {
                hashMap.put("format", this.f.getFormat().toString());
            }
            if (this.f.getPixelType() != null) {
                hashMap.put("pixelType", this.f.getPixelType().toString());
            }
            String noData = this.f.getNoData();
            if (com.esri.core.internal.util.g.b(noData)) {
                hashMap.put("noData", noData);
            }
            if (this.f.getNoDataInterpretation() != null) {
                hashMap.put("noDataInterpretation", this.f.getNoDataInterpretation().toString());
            }
            if (this.f.getInterpolation() != null) {
                hashMap.put("interpolation", this.f.getInterpolation().toString());
            }
            if (this.f.getCompressionQuality() > 0) {
                hashMap.put("compressionQuality", Integer.toString(this.f.getCompressionQuality()));
            }
            if (this.f.getBandIds() != null) {
                StringBuilder sb = new StringBuilder();
                boolean z = true;
                for (int i : this.f.getBandIds()) {
                    if (z) {
                        z = false;
                    } else {
                        sb.append(',');
                    }
                    sb.append(i);
                }
                hashMap.put("bandIds", sb.toString());
            }
            if (this.f.getRenderingRule() != null) {
                hashMap.put("renderingRule", this.f.getRenderingRule().toJson());
            }
            if (com.esri.core.internal.util.g.b(this.j)) {
                MosaicRule mosaicRule = this.f.getMosaicRule();
                if (mosaicRule != null) {
                    MosaicRule mosaicRule2 = new MosaicRule(mosaicRule);
                    mosaicRule2.setWhere(this.j);
                    hashMap.put(g, mosaicRule2.toJson());
                } else {
                    com.esri.core.internal.value.a aVar = this.i;
                    if (aVar != null) {
                        int A = aVar.A();
                        String B = this.i.B();
                        String C = this.i.C();
                        int D = this.i.D();
                        if (A != -1) {
                            MosaicRule mosaicRule3 = new MosaicRule();
                            mosaicRule3.setMethod(A);
                            if (com.esri.core.internal.util.g.b(B)) {
                                mosaicRule3.setSortField(B);
                            }
                            if (com.esri.core.internal.util.g.b(C)) {
                                mosaicRule3.setSortValue(C);
                            }
                            if (D != -1) {
                                mosaicRule3.setOperation(D);
                            }
                            mosaicRule3.setWhere(this.j);
                            hashMap.put(g, mosaicRule3.toJson());
                        }
                    }
                }
            } else if (this.f.getMosaicRule() != null) {
                hashMap.put(g, this.f.getMosaicRule().toJson());
            }
            TimeExtent timeExtent = this.h;
            if (timeExtent != null) {
                hashMap.put("time", timeExtent.toString());
            }
        }
        return hashMap;
    }

    public TimeExtent h() {
        return this.h;
    }

    public void a(TimeExtent timeExtent) {
        this.h = timeExtent;
    }
}
